package com.wlb.address.split.dict.defualt;

public class byteToIntUtil {
	public static int byteToInt(byte[] inBytes,int start,int len){
		int result = 0;
		if(len == 2){
			
			int num1 = inBytes[start];
			int num2 = inBytes[start+1];
			result = (((num2 & 0xff)<<8 ) | (num1 & 0xff));
			return result;
		}
		
		if(len == 4){
			int num1 = inBytes[start];
			int num2 = inBytes[start+1];
			int num3 = inBytes[start+2];
			int num4 = inBytes[start+3];
			result = (((num4 & 0xff)<<24 ) | ((num3 & 0xff)<<16 )
					|((num2 & 0xff)<<8 ) | (num1 & 0xff ));
			return result;
		}
		return 0;
	}
	
	public static boolean isChinese(char c){
		Character.UnicodeBlock ub = Character.UnicodeBlock.of(c);
		if (ub == Character.UnicodeBlock.CJK_UNIFIED_IDEOGRAPHS  
				  
                || ub == Character.UnicodeBlock.CJK_COMPATIBILITY_IDEOGRAPHS  
  
                || ub == Character.UnicodeBlock.CJK_UNIFIED_IDEOGRAPHS_EXTENSION_A  
  
                || ub == Character.UnicodeBlock.GENERAL_PUNCTUATION  
  
                || ub == Character.UnicodeBlock.CJK_SYMBOLS_AND_PUNCTUATION  
  
                || ub == Character.UnicodeBlock.HALFWIDTH_AND_FULLWIDTH_FORMS) {  
  
            return true;  
  
        }  
		
        return false;  
	}
}
